package metier.sess;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import metier.entities.Vue;



@Stateless(name="Vue")
public class VueEJBImpl implements IVueLocal,IVueRemote{
	@PersistenceContext(unitName="PU_Cargaison")
	private EntityManager em;

	@Override
	public void addVue(Vue v) {
		
		em.merge(v);
		
		
	}

	@Override
	public List<Vue> getAllVue() {
		
		Query req=em.createQuery("select v from Vue v");
		return req.getResultList();
		
	}

	@Override
	public Vue getVue(Integer Id) {
		
		Vue v=em.find(Vue.class, Id);
		return v;
	}

	@Override
	public void updateVue(Vue v) {
		
		em.merge(v);
		
	}

	@Override
	public void deleteVue(Integer Id) {
		
		Vue v=getVue(Id);
		em.remove(v);
		
	}
	

}
